﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace websitev2.Areas.Developer.Controllers
{
    public class StatOverViewController : Controller
    {
        //
        // GET: /Developer/StatOverView/

        public ActionResult Index()
        {
            return View();
        }

        public ActionResult Add()
        {
            return View(); 
        }

        [HttpPost]
        public ActionResult Add(StartStop.ServiceResources.StatOverView oOverview)
        {
            if (ModelState.IsValid)
            {

                // Add the developerID
                if (Session["DeveloperID"] != null)
                {
                    oOverview.DeveloperID = Int64.Parse(Session["DeveloperID"].ToString()); 
                        
                }
                StartStop.ServiceResources.MessageResponse oResponse = StartStop.Helpers.DetailedStatOverview.UpdateOverview(ref oOverview); 
                if (oResponse.Success)
                {
                    // Reall this should go to a list of the developers overviews, but since this hasn't been written yet, this will do. 
                    Response.Redirect("/Developer/ControlPanel"); 
                }
            }

            return View(oOverview);
        }

    }
}
